home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / IDE / SUBARTIC / SUB_ARCT / OUTPUT / STYLE_MA.JAV < prev    next >
Encoding:
Text File  |  1996-10-04  |  3.9 KB  |  133 lines

  1. package sub_arctic.output;
  2.  
  3.  
  4. import sub_arctic.input.*;
  5. import sub_arctic.output.*;
  6.  
  7. import java.awt.Font;
  8. import java.awt.Color;
  9.  
  10. /**
  11.  * This class holds onto information that the toolkit will need about
  12.  * the current way to display the interface and other properties of
  13.  * the interface w.r.t. display.
  14.  * @author Ian Smith
  15.  */
  16. public class style_manager {
  17.  
  18.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  19.    
  20.   /** Store the current style.  */
  21.   static protected style _current_style;
  22.  
  23.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  24.    
  25.   /**
  26.    * Get the currently active style manager.
  27.    *
  28.    * @return style an instance of a style which will handle this interfaces 
  29.    *               look and feel needs.
  30.    */
  31.   static public style current_style() {
  32.     if (_current_style==null) {
  33.       // XXX temporarily make motif always the default
  34.       _current_style=new motif_style();
  35.     }
  36.     return _current_style;
  37.   }
  38.  
  39.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  40.    
  41.   /**
  42.    * Change the current style.
  43.    *
  44.    * @param style s the new style handler.
  45.    */
  46.   public static void set_current_style(style s) {
  47.     _current_style=s;
  48.   }
  49.  
  50.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  51.    
  52.   /** This is sub_arctic's default color scheme. */
  53.   protected static color_scheme _default_scheme=null;
  54.  
  55.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  56.  
  57.   /**
  58.    * This gets the default color scheme for sub_arctic, predominately
  59.    * grey with a white text bg.
  60.    * 
  61.    * @return color_scheme the system default scheme
  62.    */
  63.   static public color_scheme default_color_scheme() {
  64.     if (_default_scheme==null) {
  65.       /* build a Grey color scheme */
  66.       _default_scheme=new color_scheme(Color.white, Color.black,
  67.                        new Color(153,153,153),
  68.                        new Color(191,191,191),
  69.                        new Color(115,115,115),
  70.                        new Color(230,230,230),
  71.                        new Color(178,77,122));
  72.     }
  73.     return _default_scheme;
  74.   }
  75.  
  76.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  77.  
  78.   /**
  79.    * Set the default color scheme. XXX This should force some kind
  80.    * a global redraw of all interactors that use the style_manager.
  81.    * @param color_scheme cs the new color scheme for the system.
  82.    */
  83.   static public void set_default_scheme(color_scheme cs) {
  84.     _default_scheme=cs;
  85.     /* tell the style  what  happened */
  86.     current_style().color_scheme_changed();
  87.   }
  88.  
  89.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  90.  
  91.   /** The default font for the system. */
  92.   static protected Font _default_font=new Font("Helvetica",Font.PLAIN, 12);
  93.  
  94.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  95.  
  96.   /**
  97.    * Retrieve the default font.
  98.    * @return Font the system's default font.
  99.    */
  100.   static public Font default_font() { 
  101.     return _default_font;
  102.   }
  103.  
  104.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  105.  
  106.   /**
  107.    * Set the default font.  XXX Should trigger a refresh of all 
  108.    * objects using the style system. XXX
  109.    * @param Font f the new system default font.
  110.    */
  111.   static public void set_default_font(Font f) {
  112.     _default_font=f;
  113.   }
  114.  
  115.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  116. }
  117. /*=========================== COPYRIGHT NOTICE ===========================
  118.  
  119. This file is part of the subArctic user interface toolkit.
  120.  
  121. Copyright (c) 1996 Scott Hudson and Ian Smith
  122. All rights reserved.
  123.  
  124. The subArctic system is freely available for most uses under the terms
  125. and conditions described in 
  126.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  127. and appearing in full in the lib/interactor.java source file.
  128.  
  129. The current release and additional information about this software can be 
  130. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  131.  
  132. ========================================================================*/
  133.